'''
Created on Jul 16, 2012

@author: Charlie
'''

import csv

stat_list=[]
writ_list=[]
stats = csv.reader(open('..\\data\\pokemon_moves_unsorted.csv','r', newline=''), delimiter=',', quotechar=' ')
writs=csv.writer(open('..\\data\\pokemon_moves.csv', 'w', newline=''), delimiter=',', quotechar=' ')
for row in stats:
    stat_list.append(row)
#    print (stat_list)
    if stat_list.__len__()<2:
        writ_list.append(stat_list[-1][1])
        print('shitshitshit ponies')
    elif stat_list[-1][0]!=stat_list[-2][0]:
        writs.writerow(writ_list)
        print (writ_list)
        writ_list=[]
    else:
        writ_list.append(stat_list[-1][1])